package com.tang.lts.core.jvmmonitor.mbean;

import com.sun.management.OperatingSystemMXBean;

import java.lang.management.ManagementFactory;
import java.lang.management.RuntimeMXBean;
import java.lang.management.ThreadMXBean;
import java.math.BigDecimal;

/**
 * @author Tang
 * @classname JVMThread
 * @description [  ]
 * @date 2022/5/10 13:58
 */
public class JVMThread implements JVMThreadMBean {

    private static final JVMThread instance = new JVMThread();

    public static JVMThread getInstance() {
        return instance;
    }

    private ThreadMXBean threadMXBean;
    private OperatingSystemMXBean OperatingSystem;
    private RuntimeMXBean Runtime;

    private volatile long lastCPUTime;
    private volatile long lastCPUUpTime;


    private JVMThread() {
        threadMXBean = ManagementFactory.getThreadMXBean();
        OperatingSystem = (OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean();
        Runtime = ManagementFactory.getRuntimeMXBean();

        try {
            lastCPUTime = OperatingSystem.getProcessCpuTime();
        } catch (Exception e) {

        }
    }

    @Override
    public int getDaemonThreadCount() {
        return 0;
    }

    @Override
    public int getThreadCount() {
        return 0;
    }

    @Override
    public long getTotalStartedThreadCount() {
        return 0;
    }

    @Override
    public int getDeadLockedThreadCount() {
        return 0;
    }

    @Override
    public BigDecimal getProcessCpuTimeRate() {
        return null;
    }
}